package com.clstu.date_;

import java.util.Calendar;

public class Calendar_ {
    public static void main(String[] args) {
        //第二代日期时间表示，已经不太实用
        Calendar c = Calendar.getInstance();
        //System.out.println(c);//很长一个字符串，包含了很多信息，通常不直接使用
//        System.out.println(c.get(Calendar.YEAR));
//        System.out.println(c.get(Calendar.MONTH)+1);//从0开始算，所以+1
//        System.out.println(c.get(Calendar.DAY_OF_MONTH));
//        System.out.println(c.get(Calendar.HOUR_OF_DAY));//12小时计数的
//        System.out.println(c.get(Calendar.MINUTE));
//        System.out.println(c.get(Calendar.SECOND));
//        System.out.println(c.get(Calendar.MINUTE));
        System.out.println(c.get(Calendar.YEAR)+"/"+c.get(Calendar.MONTH)+"/"+c.get(Calendar.DAY_OF_MONTH)+" "+c.get(Calendar.HOUR_OF_DAY)+
                 ":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND));//自己拼接得到时间


    }
}
